package main

import (
	"encoding/binary"
	"fmt"
)

func main() {
	//	s := strings.NewReader("01081820ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz")
	//	br := bufio.NewReader(s)
	//fmt.Println(br)
	//fmt.Println("----------------")
	//	b := make([]byte, 32)
	//	b = append(b, 0x23, 0xab, 0x2f, 0x01, 0x85, 0x25, 0x00, 0x00, 0x0e, 0x27, 0x00, 0x00, 0x6b, 0x25, 0x00, 0x00, 0x0e, 0x27, 0x00, 0x00, 0x00, 0x36, 0xf1, 0x48, 0xec, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, 00)
	//	b := []byte{0x23, 0xab, 0x2f, 0x01, 0x85, 0x25, 0x00, 0x00, 0x0e, 0x27, 0x00, 0x00, 0x6b, 0x25, 0x00, 0x00, 0x0e, 0x27, 0x00, 0x00, 0x00, 0x36, 0xf1, 0x48, 0xec, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, 00}
	b := []byte{0x23, 0xab, 0x2f, 0x01, 0x23, 0xab, 0x2f, 0x01, 0x23, 0xab, 0x2f, 0x01, 0x23, 0xab, 0x2f, 0x01, 0x23, 0xab, 0x2f, 0x01, 0x23, 0xab, 0x2f, 0x01, 0x23, 0xab, 0x2f, 0x01, 0x23, 0xab, 0x2f, 0x01}

	//		b = {0x23, 0xab, 0x2f, 0x01, 0x85, 0x25, 0x00, 0x00, 0x0e, 0x27, 0x00, 0x00, 0x6b, 0x25, 0x00, 0x00, 0x0e, 0x27, 0x00, 0x00, 0x00, 0x36, 0xf1, 0x48, 0xec, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, 00}

	k := make([]byte, 4)
	//	var k [4]byte

	//n, err := br.Read(b)
	//copy(k, b[:4])
	copy(k, b[0:4])
	//copy(k, b[4:8])
	/*
		n1 := int32(uint(k[3]))
				n1 = n1 << 24
				n2 := int32(uint(k[2]))
				n2 = n2 << 16
				n3 := int32(uint(k[1]))
				n3 = n3 << 8
				n4 := int32(uint(k[0]))

			n1 := int32(20)
			n1 = n1 << 24
			n2 := int32(18)
			n2 = n2 << 16
			n3 := int32(8)
			n3 = n3 << 8
			n4 := int32(19)
			n5 := n1 | n2 | n3 | n4
			n6 := n1 & n2 & n3 & n4
			fmt.Println(k, n6, n5, n4, n3, n2, n1)


		k[0] = 0x23
		k[1] = 0xab
		k[2] = 0x2f
		k[3] = 0x1
	*/

	//_ = b[3] // bounds check hint to compiler; see golang.org/issue/14808
	n1 := binary.LittleEndian.Uint32(k) //	return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24
	n2 := binary.BigEndian.Uint32(k)    // return uint32(b[3]) | uint32(b[2])<<8 | uint32(b[1])<<16 | uint32(b[0])<<24

	fmt.Println(k, n2, n1)
	/*
		fmt.Printf("%-20s %-2v %v\n", b[:n], n, err)
		// ABCDEFGHIJKLMNOPQRST 20 <nil>

		n, err = br.Read(b)
		fmt.Printf("%-20s %-2v %v\n", b[:n], n, err)
		// UVWXYZ1234567890 16 <nil>

		n, err = br.Read(b)
		fmt.Printf("%-20s %-2v %v\n", b[:n], n, err)
		// 0 EOF
	*/
}
